package com.kygeng.datanode;

/**
 * @Title: DataNode
 * @Author: kygeng
 * @Package: com.kygeng.datanode
 * @Date: 2025/3/2 18:03
 * @Description: 从节点
 */
public class DataNode {

    /**
     * 是否正在运行
     */
    private volatile Boolean shouldRun;

    /**
     * 负责跟一组NameNode通信的组件
     */
    private NameNodeOfferService offerService;

    /**
     * 初始化从节点
     */
    private void  initialize(){
        this.shouldRun = true;
        this.offerService = new NameNodeOfferService();
        this.offerService.start();
    }

    /**
     * 运行从节点
     */
    private void run(){
        while (shouldRun){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }


    public static void main(String[] args) {
        DataNode datanode = new DataNode();
        datanode.initialize();
        datanode.run();
    }

}
